package mq

import (
	"charging_pile/devices/internal/svc"
	"charging_pile/util/protocol/jiuxing"
	"time"

	"github.com/zeromicro/go-zero/core/logx"
)

var channel0A = make(chan *jiuxing.Package, 1000)

func handle0A(nc *natsClient, in *jiuxing.Package) *jiuxing.Package {
	msg := jiuxing.Msg0A{
		Tm:      []byte{},
		Voltage: []uint16{},
		Current: []uint16{},
		Plugs:   []jiuxing.Plug{},
	}
	msg.Decode(in.Payload)
	logx.Infof("msg0A%+v", msg)

	return nil
}

func beachHand0A(nc *svc.ServiceContext) {
	for {
		select {
		case pack := <-channel0A:
			logx.Info(pack)
		case <-time.After(500 * time.Millisecond):

		}
	}
}

func init() {
	HandlerMap[uint8(0x0a)] = handle0A
}
